<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function f() {
            var arr = [3,4,3,5,7,9];
            var count = 0;
            for (var i = 0; i < arr.length; i++) {
                if (arr[i]==3) {
                    count++;
                }
            }
            console.log("3在数组中出现了"+count+"次");
        }
        f();

    </script>
</head>
<body>

</body>
</html>